#!/usr/bin/env bash
# Copyright (c) 2024 maminjie <canpool@163.com>
# SPDX-License-Identifier: MulanPSL-2.0

method_def build

OSBUILD_DIR=$SHCANPOOL_DIR/tools/osbuild

usage_build() {
    module_usage "build (b)" "Build tool"
}

alias_def build b
do_build() {
    module_do "build" "$@"
}

build_usage_help() {
    module_usage_help build
}

# build_do_help subcmd
build_do_help() {
    module_do_help build "$1"
}

# __build_get_subcmd cmd
#   Get the fullname of cmd
# Returns:
#   "" or fullname
__build_get_subcmd() {
    local cmd=""
    case "${1}" in
        "h"|"help")
            cmd="help"
            ;;
        "c"|"container")
            cmd="container"
            ;;
        *)
            ;;
    esac
    echo "$cmd"
}


build_usage_container() {
printf "container (c): build container image based on yum repository

usage:
    ${PROG} build c [options] <args...>
\n"
}

build_do_container() {
    script_do_bash "$OSBUILD_DIR/build_docker_image.sh" "$@"
}
